<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>

<body>
<div th:fragment="foot">
<a href="javascript:toPage(3)">首页</a>
<a href="javascript:toPage(1)">上一页</a>
<a href="javascript:toPage(2)">下一页</a>
<a href="javascript:toPage(4)">尾页</a>
<form id="OneForm">
    第<input type="text" name="pageNumber"  id="pageNumber" readonly="readonly" size="1px">页
    共<input type="text" name="tatalPage"  id="tatalPage" readonly="readonly" size="2px">页
    共<input type="text" name="totalCount"  id="totalCount" readonly="readonly" size="4px">条
    每页<input type="text" name="pageSize"  id="pageSize"  size="1px">条
</form>
<script type="text/javascript">
    function toPage(obj){
        //拿到参数进行转换为数字
        //当前页数
        var pageNumber = parseInt($("#pageNumber").val());
        //总页数
        var tatalPage = parseInt($("#tatalPage").val());
        if (obj == 1) {
            if (pageNumber == 1) {
                alert("已经是首页了，亲")
                return;
            }
            $("#pageNumber").val(pageNumber - 1);

        }else if(obj == 2){
            if (pageNumber == tatalPage) {
                alert("已经是尾页了，亲");
                return;
            }
            $("#pageNumber").val(pageNumber + 1);

        }else if (obj == 3) {
            if (pageNumber == 1) {
                alert("已经是首页了，亲")
                return;
            }
            $("#pageNumber").val(1);
        }else if (obj == 4) {
            if (pageNumber == tatalPage) {
                alert("已经是尾页了，亲");
                return;
            }
            $("#pageNumber").val(tatalPage);
        }
        show()
    }

    function pageInstall(page){
        //获取当前页数赋值给文本框
        $("#pageNumber").val(page.pageNumber);
        //获取总页数
        $("#tatalPage").val(page.totalPage);
        //获取总条数
        $("#totalCount").val(page.totalCount);
        //每页几条
        $("#pageSize").val(page.pageSize);
    }
</script>
</div>
</body>
</html>